]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
user-menu: Keep track of current presence
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 2 Sep 2011 12:15:31 +0000 (14:15 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 2 Sep 2011 16:13:09 +0000 (18:13 +0200)
We keep track of presence changes by connecting to the
Tp.AccountManager:most-available-presence-changed signal.
However, if multiple accounts are in use, telepathy may
lie to us and emit the signal even when the most available
presence is unchanged.
Work around this by keeping track of the current presence
ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=657703

js/ui/userMenu.js

index 115bcf7c1dfe138ae2160f0b8d0449c3dc020170..d5349bae26f0b43d885e1c9f8ee3c85d7aca5df5 100644 (file)
@@ -170,6 +170,7 @@ IMStatusChooserItem.prototype = {
         this._presence.connect('StatusChanged',
                                Lang.bind(this, this._sessionStatusChanged));
 
+        this._currentPresence = undefined;
         this._previousPresence = undefined;
 
         this._accountMgr = Tp.AccountManager.dup()
@@ -267,6 +268,11 @@ IMStatusChooserItem.prototype = {
     },
 
     _IMStatusChanged: function(accountMgr, presence, status, message) {
+        if (presence == this._currentPresence)
+            return;
+
+        this._currentPresence = presence;
+
         if (presence == Tp.ConnectionPresenceType.AVAILABLE)
             this._presence.setStatus(GnomeSession.PresenceStatus.AVAILABLE);